Data centers provide access to external networks at edge service gateways. In data centers providing software defined networks to tenants, a logical network may be organized in a manner that is significantly different from an underlying physical network. As such, edge service gateways placed on a same logical switch may be located in disparate locations of the physical network. Therefore, methods for addressing a closest edge service gateway from source machines connected to a logical network is needed.